home *** CD-ROM | disk | FTP | other *** search
- Path: news.mira.net.au!news
- From: davidw@werple.net.au (David White)
- Newsgroups: comp.lang.c++
- Subject: Re: Is there a standard for * and & placement style?
- Date: 20 Feb 1996 21:21:34 +1100
- Organization: Werple Internet, Melbourne
- Message-ID: <4gc7be$gta@werple.net.au>
- References: <3128BD31.4AF8@wildfire.com>
- NNTP-Posting-Host: werple.mira.net.au
-
- Stonewall Ballard <stoney@wildfire.com> writes:
-
- >I'm trying to find out whether there is a "standard" for the
- >placement of * and &. A survey of C++ texts shows that most use
-
- >Form 1
- > int& foo;
- > int* foo;
-
- >while some use
-
- >Form 2
- > int& foo;
- > int *foo;
-
- >and nobody uses (although I've seen this a lot in code)
-
- >Form 3
- > int &foo;
- > int *foo;
-
- >The ARM and the latest C++ working paper both use form 1. The
- >most well-known user of form 2 is Scott Meyers in his Effective
- >C++ books. People I work with use form 3.
-
- >Imagine that you were given a class framework to use and extend.
- >Would you expect that the placement of & and * follow one of the
- >above schemes? Do you perceive that there is a standard for the
- >placement of * and &? If so, what is it?
-
- >Please reply by email to stoney@wildfire.com
-
- >I will summarize the results to the group.
-
- There doesn't seem to be a standard. My preference is 'int *foo', because
- that's the way the compiler sees it. For example, what is the type of 'q'
- here? int* p, q;
- Also, there are cases when you have no choice, e.g., int (*foo)();
-
- David White
- davidw@werple.mira.net.au
-
-